package com.example.administrator.myapplication;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/*
* TODO:Get请求网络
* */
public class HttpContect_GetActivity {
        String returnCode="";
        String target = "http://soymilk.nfc100.cn/";
        public String send(String rount){
            try {
                String target;
                target = this.target+rount;
                URL url=new URL(target);
                String resultData="";
                HttpURLConnection connection= (HttpURLConnection) url.openConnection();
                int code=connection.getResponseCode();
                InputStreamReader reader=new InputStreamReader(connection.getInputStream());
                BufferedReader bufferedReader=new BufferedReader(reader);
                String input="";
                while ((input=bufferedReader.readLine())!=null){
                    resultData+=input;
                    }
                return resultData;
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
}
